Package-level declarations

Types

Link copied to clipboard
class FixedQueue<T>(val capacity: Int) : Queue<T>

A strict queue with the given capacity. The differences from java.util.ArrayDeque are:

Inherited functions

Link copied to clipboard
inline fun <T : Any> Array<*>.findIsInstance(check: (T) -> Boolean = { true }): T?

Finds the first T element of this array that satisfies the check, returning null if nothing was found.

inline fun <T : Any> Iterable<*>.findIsInstance(check: (T) -> Boolean = { true }): T?

Finds the first T element of this iterable that satisfies the check, returning null if nothing was found.

inline fun <T : Any> Iterator<*>.findIsInstance(check: (T) -> Boolean = { true }): T?

Finds the first T element of this iterator that satisfies the check, returning null if nothing was found.

inline fun <T : Any> Sequence<*>.findIsInstance(check: (T) -> Boolean = { true }): T?

Finds the first T element of this sequence that satisfies the check, returning null if nothing was found.

Link copied to clipboard
inline fun <T : Any> Array<*>.firstIsInstance(check: (T) -> Boolean = { true }): T

Finds the first T element of this array that satisfies the check, throwing an error if nothing was found.

inline fun <T : Any> Iterable<*>.firstIsInstance(check: (T) -> Boolean = { true }): T

Finds the first T element of this iterable that satisfies the check, throwing an error if nothing was found.

inline fun <T : Any> Iterator<*>.firstIsInstance(check: (T) -> Boolean = { true }): T

Finds the first T element of this iterator that satisfies the check, throwing an error if nothing was found.

inline fun <T : Any> Sequence<*>.firstIsInstance(check: (T) -> Boolean = { true }): T

Finds the first T element of this sequence that satisfies the check, throwing an error if nothing was found.

Link copied to clipboard
inline fun <T> Array<out T>.getOrDefault(index: Int, default: T): T

An alternative to the Array.getOrElse function for precomputed values.

inline fun <T> List<T>.getOrDefault(index: Int, default: T): T

An alternative to the List.getOrElse function for precomputed values.

inline fun <K, V> Map<K, V>.getOrDefault(key: K, default: V): V

An alternative to the Map.getOrElse function for precomputed values.

Link copied to clipboard
inline fun <T> Array<out T>.getOrThrow(index: Int, message: Array<out T>.(Int) -> String): T

An alternative to the Array.get function that throws an exception with the provided message.

inline fun <T> List<T>.getOrThrow(index: Int, message: List<T>.(Int) -> String): T

An alternative to the List.get function that throws an exception with the provided message.

inline fun <K, V> Map<K, V>.getOrThrow(key: K, message: Map<K, V>.(K) -> String): V

An alternative to the Map.get function that throws an exception with the provided message.

Link copied to clipboard
inline fun <T> Array<out T>.getResult(index: Int): Result<T>

An alternative to the Array.get function that wraps it in a Result.

inline fun <T> List<T>.getResult(index: Int): Result<T>

An alternative to the List.get function that wraps it in a Result.

inline fun <K, V> Map<K, V>.getResult(key: K): Result<V>

An alternative to the Map.get function that wraps it in a Result.

inline fun <T> Array<out T>.getResult(index: Int, message: Array<out T>.(Int) -> String): Result<T>

An alternative to the Array.get function that wraps it in a Result with the provided message

inline fun <T> List<T>.getResult(index: Int, message: List<T>.(Int) -> String): Result<T>

An alternative to the List.get function that wraps it in a Result with the provided message

inline fun <K, V> Map<K, V>.getResult(key: K, message: Map<K, V>.(K) -> String): Result<V>

An alternative to the Map.get function that wraps it in a Result with the provided message

Link copied to clipboard
inline fun <T, C : Collection<T>> C.ifNotEmpty(action: C.() -> Unit): C

Applies the action to this collection if it's not empty.

inline fun <K, V, M : Map<K, V>> M.ifNotEmpty(action: M.() -> Unit): M

Applies the action to this map if it's not empty.

inline fun <T> Array<out T>.ifNotEmpty(action: Array<out T>.() -> Unit): Array<out T>

Applies the action to this array if it's not empty.

Link copied to clipboard
fun <T> Collection<T>.present(limit: Int = -1): String
fun <T> Collection<T>.present(limit: Int = -1, format: (T) -> CharSequence): String

Pretty-prints the provided collection in JSON array style.

fun <K, V> Map<K, V>.present(limit: Int = -1): String
fun <K, V> Map<K, V>.present(limit: Int = -1, format: (k: K, v: V) -> CharSequence): String

Pretty-prints the provided map in JSON dictionary style.